/**
 * 
 */
package idv.takeshi.software.productline.bookstore.domain.model.book;

import java.util.Set;

import org.apache.commons.lang.Validate;

/**
 * A repository for Book.
 * @author takeshi
 *
 */
public interface BookRepository {
	
	/**
	 * Add a book.
	 * @param book
	 * @exception BookDuplicateException
	 */
	public abstract void add(Book book) throws BookDuplicateException;
	
	/**
	 * Find a book by id.
	 * @param id
	 * @return
	 */
	public abstract Book findById(Long id);
	
	/**
	 * Find a book by name.
	 * @param name
	 * @return
	 */
	public abstract Book findByName(String name);
	
	/**
	 * Remove a book.
	 * @param book
	 */
	public abstract void remove(Book book);
	
	/**
	 * Add an inventory.
	 * @param inventory
	 */
	public abstract void add(Inventory inventory);
	
	/**
	 * Remove an inventory.
	 * @param inventory
	 */
	public abstract void remove(Inventory inventory);
	
	/**
	 * Add a promotion.
	 * @param promotion
	 */
	public abstract void add(Promotion promotion);
	
	/**
	 * Remove a promotion.
	 * @param promotion
	 */
	public abstract void remove(Promotion promotion);
	
	/**
	 * update a book.
	 * @param book
	 */
	public void update(Book book);
	
	/**
	 * Find fromTopN ~ toTopN Book Objects by given key word.
	 * @param keyWord
	 * @return
	 */
	public Set<Book> findBooksByKeyWord(String keyWord, int fromTopN, int toTopN);
	
	/**
	 * Find topN Book Objects by given key word.
	 * @param keyWord
	 * @return
	 */
	public Set<Book> findBooksByKeyWord(String keyWord, int topN);
	
	/**
	 * Find Book Objects by given key word.
	 * @param keyWord
	 * @return
	 */
	public Set<Book> findBooksByKeyWord(String keyWord);
	
	/**
	 * Find amount of books by given key word.
	 * @param keyWord
	 * @return
	 */
	public int findBooksAmountByKeyWord(String keyWord);
	
}
